home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / NextAnswers / 1296_slashes_and_viewing_mounts_with_niutil.rtf < prev    next >
Text File  |  1995-06-12  |  2KB  |  73 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\fmodern Courier;\f2\fmodern Ohlfs;}
  2. \paperw10680
  3. \paperh8200
  4. \margl120
  5. \margr120
  6. {\colortbl;\red0\green0\blue0;\red84\green84\blue84;\red83\green83\blue83;}
  7. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ulnone\fs28\fc1\cf1 Q: How do I access the individual 'mounts' database entries using niutil?  Because of the slashes in the property values, niutil doesn't seem to understand the input.\
  8. \
  9. A: Indeed, if you try something straightforward like:\
  10.  
  11. \fs24\fc0\cf0 \
  12.  
  13. \f1\fc1\cf1     niutil -read . /mounts//dev/sd0a\
  14.  
  15. \f0\fc0\cf0 \
  16.  
  17. \fs28\fc1\cf1 you get an error message such as\
  18.  
  19. \fs24\fc0\cf0 \
  20.  
  21. \f1\fc1\cf1     niutil: can't open .:/mounts//dev/rsd0a\
  22.  
  23. \f0\fc0\cf0 \
  24.  
  25. \fs28\fc1\cf1 because niutil is using / to separate properties.  So, let's say we have the following:\
  26.  
  27. \fs24\fc0\cf0 \
  28.  
  29. \f1\fc1\cf1     % niutil -list . /mounts\
  30.     133      /dev/sd0a \
  31.     134      /dev/sd0b \
  32.     137      /dev/sd1a \
  33.  
  34. \f0\fc0\cf0 \
  35.  
  36. \fs28\fc1\cf1 and we want to execute niutil -read on the /dev/sd0a entry.  We have to find some way to escape those slashes in the property value (“/dev/sd0a”) or we're sunk.  The simple ways don't work:\
  37.  
  38. \fs24\fc0\cf0 \
  39.  
  40. \f1\fc1\cf1     % niutil -read . /mounts\\/dev\\/rsd0a\
  41.     niutil: can't open .:/mounts/dev/rsd0a\
  42. \
  43.     % niutil -read . /mounts/'/dev/rsd0a'\
  44.     niutil: can't open .:/mounts//dev/rsd0a\
  45.  
  46. \f0\fc0\cf0 \
  47.  
  48. \fs28\fc1\cf1 Turns out it's necessary to use a DOUBLE backslash to get the proper escaping:\
  49.  
  50. \fs24\fc0\cf0 \
  51.  
  52. \f1\fc1\cf1     % niutil -read . /mounts/\\\\/dev\\\\/sd0a\
  53.     name: /dev/sd0a \
  54.     dir: / \
  55.     type: 4.3 \
  56.     opts: rw noquota noauto \
  57.     freq: 1 \
  58.     passno: 1 \
  59.  
  60. \f0\fc0\cf0 \
  61.  
  62. \fs28\fc1\cf1 Why?  Because if one types simply '\\/' the shell gobbles the escape character\
  63. (the \\), and transform this into '/'.  If one types TWO slashes, then the shell turns\
  64. them into one, and there is one in the string passed to niutil as its argument.\
  65.  
  66. \fs24\fc0\cf0 \
  67.  
  68. \fs28\fc1\cf1 QA344\
  69. \
  70. Valid for 1.0, 2.0,3.0,3.1\
  71. \
  72.  
  73.